﻿using System;

namespace Problem2
{
	//By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
	class Problem0002
	{
		static void Main(string[] args)
		{
			int term1 = 1;
			int term2 = 2;
			int term3 = 3;
			int total = 2; // first even numbered element won't be found by Fibonnaci logic
			do
			{
				if(term3%2 == 0)
					total += term3;
				term1 = term2;
				term2 = term3;
				term3 = term1 + term2;
			} while (term3<4000000);

			Console.Write(total);
			Console.Read();
		}
	}
}
